/**
 * Created by 熊晨名 on 2019/6/19.
 */
//###########官网品牌简介组件##########1
Comps.brandOverview = function(config) {
	this.compId = config.compId;
	this.needAsyncInit = config.needAsyncInit;
    this.brandOverviewList = config.brandOverviewList;
}

Comps.brandOverview.prototype.init = function() {
	var that =this;
	var brandOverviewList = this.brandOverviewList ;
	if (this.needAsyncInit) {
		if(brandOverviewList != '' && brandOverviewList.length > 0) {
            var compDivEle = $(".brandOverview_div").first();
            $("#"+that.compId+"_div").html("");
			for (var i = 0 ; i < brandOverviewList.length ; i++) {
                var compDivConleEle = compDivEle.clone();
                var String = brandOverviewList[i];
                compDivConleEle.find(".brandOverview_name").first().html(String.name);
                compDivConleEle.find(".brandOverview_remark").first().html(String.remark);
            	if (String.imgSrc != null) {
                    compDivConleEle.find(".brandOverview_img").first().attr("src",String.imgSrc);
            	}
            	if (String.jumpUrl != null) {
                    compDivConleEle.find(".brandOverview_a").first().attr("href",String.jumpUrl);
            	}
                $("#"+that.compId+"_div").append(compDivConleEle);
			 }
            $("#"+that.compId+"_describe").html(decodeURI($.base64.decode(content)));
		}
	}
    Utils.ajaxLoadComplate(that);
}
//###########官网品牌简介组件##########



//###########企业全部荣誉组件##########2
Comps.allHonor = function(config) {
    this.compId = config.compId;
    this.needAsyncInit = config.needAsyncInit;
    this.allHonorList = config.allHonorList;
}

Comps.allHonor.prototype.init = function() {
    var that =this;
    var allHonorList = this.allHonorList ;
    if (this.needAsyncInit) {
        if(allHonorList != '' && allHonorList.length > 0) {
            //对list进行排序
            allHonorList.sort(function(a,b){
                return a.sequence-b.sequence;
            });
            var compDivEle = $(".allHonor_div").first();
            $("#"+that.compId+"_div").html("");
            for (var i = 0 ; i < allHonorList.length ; i++) {
                var compDivConleEle = compDivEle.clone();
                var String = allHonorList[i];
                compDivConleEle.find(".allHonor_name").first().html(String.name);
                compDivConleEle.find(".allHonor_remark").first().html(String.remark);
                if (String.imgSrc != null) {
                    compDivConleEle.find(".allHonor_img").first().attr("src",String.imgSrc);
                }
                $("#"+that.compId+"_div").append(compDivConleEle);
            }
            $("#"+that.compId+"_describe").html(decodeURI($.base64.decode(content)));
        }
    }
    Utils.ajaxLoadComplate(that);
}

//###########企业全部荣誉组件##########


//###########首页头部链接跳转组件##########3
Comps.jumpTerm = function(config) {
    this.compId = config.compId;
    this.needAsyncInit = config.needAsyncInit;
    this.jumpTermList = config.jumpTermList;
}

Comps.jumpTerm.prototype.init = function() {
    var that =this;
    var jumpTermList = this.jumpTermList ;
    if (this.needAsyncInit) {
        if(jumpTermList != '' && jumpTermList.length > 0) {
            var compEleDiv2 = $(".jumpTerm_div_a");
            var compEleDiv3 = $(".jumpTerm_span");
            $("#"+that.compId+"_div_div").html("");
            var jump = jumpTermList.length;
            for (var i = 0 ; i < jumpTermList.length ; i++) {
                var compDivConleEle2 = compEleDiv2.clone();
                var compDivConleEle3 = compEleDiv3.clone();
                var String = jumpTermList[i];
                compDivConleEle2.html(String.name);
                console.log(compDivConleEle2);
                if (String.jumpUrl != null) {
                    compDivConleEle2.attr("href",String.jumpUrl);
                }
                if (i != jump-1){
                    compDivConleEle3.html(">");

                }else {
                    compDivConleEle3.html("");

                }
                $("#"+that.compId+"_div_div").append(compDivConleEle2);
                $("#"+that.compId+"_div_div").append(compDivConleEle3);
            }

            $("#"+that.compId+"_describe").html(decodeURI($.base64.decode(content)));
        }
    }
    Utils.ajaxLoadComplate(that);
}

//###########首页头部链接跳转组件##########

//###########企业文化组件##########4
Comps.enterpriseCulture = function(config) {
    this.compId = config.compId;
    this.needAsyncInit = config.needAsyncInit;
    this.enterpriseCultureList = config.enterpriseCultureList;
}

Comps.enterpriseCulture.prototype.init = function() {
    var that =this;
    var enterpriseCultureList = this.enterpriseCultureList ;
    if (this.needAsyncInit) {
        if(enterpriseCultureList != '' && enterpriseCultureList.length > 0) {
            var compDivEle = $(".enterpriseCulture_div").first();
            $("#"+that.compId+"_div").html("");
            for (var i = 0 ; i < enterpriseCultureList.length ; i++) {
                var compDivConleEle = compDivEle.clone();
                var String = enterpriseCultureList[i];
                compDivConleEle.find(".enterpriseCulture_name").first().html(String.name);
                compDivConleEle.find(".enterpriseCulture_remark").first().html(String.remark);
                if (String.imgSrc != null) {
                    compDivConleEle.find(".enterpriseCulture_img").first().attr("src",String.imgSrc);
                }
                if (String.jumpUrl != null) {
                    compDivConleEle.find(".enterpriseCulture_a").first().attr("href",String.jumpUrl);
                }
                $("#"+that.compId+"_div").append(compDivConleEle);
            }
            $("#"+that.compId+"_describe").html(decodeURI($.base64.decode(content)));
        }
    }
    Utils.ajaxLoadComplate(that);
}
//###########企业文化组件##########


//###########工作推荐组件##########5
Comps.jobOffer = function(config) {
    this.compId = config.compId;
    this.needAsyncInit = config.needAsyncInit;
    this.jobOfferList = config.jobOfferList;
}

Comps.jobOffer.prototype.init = function() {
    var that =this;
    var jobOfferList = this.jobOfferList ;
    if (this.needAsyncInit) {
        if(jobOfferList != '' && jobOfferList.length > 0) {
            var compDivEle = $(".jobOffer_div").first();
            $("#"+that.compId+"_div").html("");
            for (var i = 0 ; i < jobOfferList.length ; i++) {
                var compDivConleEle = compDivEle.clone();
                var String = jobOfferList[i];
                compDivConleEle.find(".jobOffer_name").first().html(String.name);
                compDivConleEle.find(".jobOffer_remark1").first().html(String.remark1);
                compDivConleEle.find(".jobOffer_remark2").first().html(String.remark2);
                if (String.imgSrc != null) {
                    compDivConleEle.find(".jobOffer_img").first().attr("src",String.imgSrc);
                }
                if (String.jumpUrl != null) {
                    compDivConleEle.find(".jobOffer_a").first().attr("href",String.jumpUrl);
                }
                $("#"+that.compId+"_div").append(compDivConleEle);
            }
            $("#"+that.compId+"_describe").html(decodeURI($.base64.decode(content)));
        }
    }
    Utils.ajaxLoadComplate(that);
}
//###########工作推荐组件##########



//###########自助服务组件##########6
Comps.selfService = function(config) {
    this.compId = config.compId;
    this.needAsyncInit = config.needAsyncInit;
    this.selfServiceList = config.selfServiceList;
}

Comps.selfService.prototype.init = function() {
    var that =this;
    var selfServiceList = this.selfServiceList ;
    if (this.needAsyncInit) {
        if(selfServiceList != '' && selfServiceList.length > 0) {
            var compDivEle = $(".selfService_div").first();
            $("#"+that.compId+"_div").html("");
            for (var i = 0 ; i < selfServiceList.length ; i++) {
                var compDivConleEle = compDivEle.clone();
                var String = selfServiceList[i];
                compDivConleEle.find(".selfService_name").first().html(String.name);
                compDivConleEle.find(".selfService_remark1").first().html(String.remark1);
                compDivConleEle.find(".selfService_remark2").first().html(String.remark2);
                if (String.imgSrc != null) {
                    compDivConleEle.find(".selfService_img").first().attr("src",String.imgSrc);
                }
                if (String.jumpUrl != null) {
                    compDivConleEle.find(".selfService_a").first().attr("href",String.jumpUrl);
                }
                $("#"+that.compId+"_div").append(compDivConleEle);
            }
            $("#"+that.compId+"_describe").html(decodeURI($.base64.decode(content)));
        }
    }
    Utils.ajaxLoadComplate(that);
}
//###########自助服务组件##########


//###########联系我们组件##########7
Comps.connectUs = function(config) {
    this.compId = config.compId;
    this.needAsyncInit = config.needAsyncInit;
    this.connectUsList = config.connectUsList;
}

Comps.connectUs.prototype.init = function() {
    var that =this;
    var connectUsList = this.connectUsList ;
    /*if (this.needAsyncInit) {
        if(connectUsList != '' && connectUsList.length > 0) {
            var compDivEle = $(".connectUs_div").first();
            $("#"+that.compId+"_div").html("");
            for (var i = 0 ; i < connectUsList.length ; i++) {
                var compDivConleEle = compDivEle.clone();
                var String = connectUsList[i];
                compDivConleEle.find(".connectUs_name").first().html(String.name);
                compDivConleEle.find(".connectUs_remark1").first().html(String.remark1);
                if (String.imgSrc != null) {
                    compDivConleEle.find(".connectUs_img").first().attr("src",String.imgSrc);
                }
                if (String.jumpUrl != null) {
                    compDivConleEle.find(".connectUs_a").first().attr("href",String.jumpUrl);
                }
                $("#"+that.compId+"_div").append(compDivConleEle);
            }
            $("#"+that.compId+"_describe").html(decodeURI($.base64.decode(content)));
        }
    }*/
    $(".connectUs_show").click(function(){
        $(".contan-float").show();
    });
    $(".contan-float").click(function () {
        $(this).hide()
    })
    Utils.ajaxLoadComplate(that);
}
Comps.connectUs.prototype.bindEvent = function() {

}
//###########联系我们组件##########


//###########管家服务组件##########8
Comps.housekeeper = function(config) {
    this.compId = config.compId;
    this.needAsyncInit = config.needAsyncInit;
    this.housekeeperList = config.housekeeperList;
}

Comps.housekeeper.prototype.init = function() {
    var that =this;
    var housekeeperList = this.housekeeperList ;
    if (this.needAsyncInit) {
        if(housekeeperList != '' && housekeeperList.length > 0) {
            var compEleDiv2 = $(".housekeeper_img_big_div");
            var compEleDiv3 = $(".housekeeper_div_div");
            $("#"+that.compId+"_div_div").html("");
            for (var i = 0 ; i < housekeeperList.length ; i++) {
                var String = housekeeperList[i];
                if (i == 0){
                    var compDivConleEle2 = compEleDiv2.clone();
                    if (String.imgSrc != null) {
                        compDivConleEle2.find(".housekeeper_img_big").first().attr("src",String.imgSrc);
                    }
                    $("#"+that.compId+"_div").append(compDivConleEle2);
                }else {
                    var compDivConleEle3 = compEleDiv3.clone();
                    if (String.imgSrc != null) {
                        compDivConleEle3.find(".housekeeper_img").first().attr("src",String.imgSrc);
                    }
                    if (String.jumpUrl != null) {
                        compDivConleEle3.find(".housekeeper_a").first().attr("href",String.jumpUrl);
                    }
                    compDivConleEle3.find(".housekeeper_name").first().html(String.name);
                    $("#"+that.compId+"_div_div").append(compDivConleEle3);
                }
            }
            $("#"+that.compId+"_describe").html(decodeURI($.base64.decode(content)));
        }
    }
    Utils.ajaxLoadComplate(that);
}
//###########管家服务组件##########


//###########保修承诺书及收费标准组件##########9
Comps.guarantee = function(config) {
    this.compId = config.compId;
    this.needAsyncInit = config.needAsyncInit;
    this.guaranteeList = config.guaranteeList;
}

Comps.guarantee.prototype.init = function() {
    var that =this;
    var guaranteeList = this.guaranteeList ;
    if (this.needAsyncInit) {
        if(guaranteeList != '' && guaranteeList.length > 0) {
            var compDivEle = $(".guarantee_div").first();
            $("#"+that.compId+"_div").html("");
            for (var i = 0 ; i < guaranteeList.length ; i++) {
                var compDivConleEle = compDivEle.clone();
                var String = guaranteeList[i];
                compDivConleEle.find(".guarantee_name").first().html(String.name);
                compDivConleEle.find(".guarantee_jumpName").first().html(String.jumpUrlName);
                if (String.imgSrc != null) {
                    compDivConleEle.find(".guarantee_img").first().attr("src",String.imgSrc);
                }
                if (String.jumpUrl != null) {
                    compDivConleEle.find(".guarantee_a").first().attr("href",String.jumpUrl);
                }
                $("#"+that.compId+"_div").append(compDivConleEle);
            }
            $("#"+that.compId+"_describe").html(decodeURI($.base64.decode(content)));
        }
    }
    Utils.ajaxLoadComplate(that);
}
//###########保修承诺书及收费标准组件##########


//###########全程无忧服务组件##########10
Comps.wholeEasy = function(config) {
    this.compId = config.compId;
    this.needAsyncInit = config.needAsyncInit;
    this.wholeEasyList = config.wholeEasyList;
}

Comps.wholeEasy.prototype.init = function() {
    var that =this;
    var wholeEasyList = this.wholeEasyList ;
    if (this.needAsyncInit) {
        if(wholeEasyList != '' && wholeEasyList.length > 0) {
            var compDivEle = $(".wholeEasy_div").first();
            $("#"+that.compId+"_div").html("");
            for (var i = 0 ; i < wholeEasyList.length ; i++) {
                var compDivConleEle = compDivEle.clone();
                var String = wholeEasyList[i];
                compDivConleEle.find(".wholeEasy_name").first().html(String.name);
                compDivConleEle.find(".wholeEasy_remark").first().html(String.remark);
                if (String.imgSrc != null) {
                    compDivConleEle.find(".wholeEasy_img").first().attr("src",String.imgSrc);
                }
                if (String.jumpUrl != null) {
                    compDivConleEle.find(".wholeEasy_a").first().attr("href",String.jumpUrl);
                }
                $("#"+that.compId+"_div").append(compDivConleEle);
            }
            $("#"+that.compId+"_describe").html(decodeURI($.base64.decode(content)));
        }
    }
    if($(window).width() <= 992) {
        serviceWindow()
    }

    $(window).resize(function () {
        if($(window).width() <= 992) {
            serviceWindow()
        }
    })

    function serviceWindow () {
        $('.service-window .flexslider').flexslider({
            controlsContainer:".slider_fullscreen2",
            animation: "slide",
            animationLoop: true,
            pauseOnAction: true,
            pauseOnHover: false,
            slideshowSpeed: 4000,
            animationDuration: 600,
        });
    }
    Utils.ajaxLoadComplate(that);
}
//###########全程无忧服务组件##########


//###########标题描述组件##########11
Comps.titleDescription = function(config){
    this.compId = config.compId;
    this.needAsyncInit = config.needAsyncInit;
    this.title = config.title;
}

Comps.titleDescription.prototype.init = function() {
    var that =this;
    if (this.needAsyncInit) {
        $("#"+that.compId+"_title").html(that.title);
        $("#"+that.compId+"_remark").html(that.remark);
    }
    Utils.ajaxLoadComplate(that);
}
//###########标题描述组件##########



//###########客户咨询组件##########12
Comps.clientConsultation = function(config) {
    this.compId = config.compId;
    this.needAsyncInit = config.needAsyncInit;
    this.clientConsultationList = config.clientConsultationList;
}

Comps.clientConsultation.prototype.init = function() {
    var that =this;
    var clientConsultationList = this.clientConsultationList ;
    if (this.needAsyncInit) {
        if(clientConsultationList != '' && clientConsultationList.length > 0) {
            var compDivEle = $(".clientConsultation_div").first();
            $("#"+that.compId+"_div").html("");
            for (var i = 0 ; i < clientConsultationList.length ; i++) {
                var compDivConleEle = compDivEle.clone();
                var String = clientConsultationList[i];
                compDivConleEle.find(".clientConsultation_name").first().html(String.name);
                if (String.imgSrc != null) {
                    compDivConleEle.find(".clientConsultation_img").first().attr("src",String.imgSrc);
                }
                if (String.jumpUrlName != null) {
                    compDivConleEle.find(".clientConsultation_jumpUrlName").first().html(String.jumpUrlName);
                }
                if (String.remark != null) {
                    compDivConleEle.find(".clientConsultation_remark").first().html(String.remark);
                }
                if (String.jumpUrl != null) {
                    compDivConleEle.find(".clientConsultation_a").first().attr("href",String.jumpUrl);
                }else {
                    compDivConleEle.find(".clientConsultation_a").first().attr("class","hidden");
                }
                $("#"+that.compId+"_div").append(compDivConleEle);
            }
            $("#"+that.compId+"_describe").html(decodeURI($.base64.decode(content)));
        }
    }
    Utils.ajaxLoadComplate(that);
}
//###########客户咨询组件##########